{% extends 'TopxiaWebBundle:My:layout.html.twig' %}

{% block title %}我的{{ setting('classroom.name')|default("班级") }} - {{ parent() }}{% endblock %}

{% set side_nav = 'my-classroom' %}

{% block main %}
<style>
.classroom-footer{

  margin-top: 50px;
}
</style>
<div class="panel panel-default panel-col lesson-manage-panel">
  <div class="panel-heading">
    我的{{ setting('classroom.name')|default("班级") }}
  </div>

  <div class="panel-body">
       <ul class="course-wide-list">
            {% if classrooms %}
            {% for classroom in classrooms %}
            {% set progress = progresses[classroom.id] %}
            <li class="course-item clearfix">
              <a class="course-picture-link" href="{{ path('classroom_show', {id:classroom.id}) }}" target="_blank">
                <img class="course-picture" src="{{ filepath(classroom.middlePicture, 'classroom.png') }}" alt="{{ classroom.title }}">
              </a>
              <div class="course-body">
                <h4 class="mbl"><a href="{{ path('classroom_show', {id:classroom.id}) }}" target="_blank">{{classroom.title}}</a>                
                {% if classroom.status == "draft" %}
                  <span class="label label-warning ">未发布</span>
                  {% elseif classroom.status == "closed" %}
                  <span class="label label-danger ">已关闭</span>
                {% endif %}
              </h4>



                {% if "student" in members[classroom.id].role %}

                <div class="pull-right">
                <span class="text-muted">已学了{{classroom.day}}天</span><br>
                <a href="{{ path('classroom_show', {id:classroom.id}) }}" class="btn btn-info btn-sm mts">继续学习</a>
                </div>
                {% else %}
                <div class="pull-right">
                <span class="text-muted">旁听生</span><br>
                <a href="{{ path('classroom_show', {id:classroom.id}) }}" class="btn btn-info btn-sm mts">进入{{ setting('classroom.name')|default("班级") }}</a>
                </div>
                {% endif %}

                <div class="classroom-footer clearfix">

                {% if "student" in members[classroom.id].role %}
                <div class="col-md-7">
                  <div class="progress" title="已学{{ progress.number }}课程">
                    <div class="progress-bar" style="width: {{ progress.percent }}">
                    </div>
                  </div>
                </div>
                <div class="col-md-2">
                  <span class="text-muted mls">共{{classroom.coursesCount}}课
                  </span>
                </div>
                {% endif %}
                

                </div>

              </div>
            </li>
            {% endfor %}
            {% else %}
            <div class="empty">还没有加入{{ setting('classroom.name')|default("班级") }}！</div>
            {% endif %}
          </ul>
  </div>
</div>

{% endblock %}